<template>
  <!-- 版心 -->
  <div class="wrap header-wrap">
    <!-- logo盒子 -->
    <div class="logo-box">
      <h1>
        <img src="../assets/img/indexLogo.6f8ac4f0.png" alt="" />
      </h1>
    </div>
    <!-- 中间导航 -->
    <ul class="nav-box">
      <li @click="$router.push('/')" :class="{ current: $route.path == '/' }">
        首页
      </li>
      <li
        @click="$router.push('/goods')"
        :class="{ current: $route.path == '/goods' }"
      >
        全部商品
      </li>
      <li
        @click="$router.push('/user')"
        :class="{ current: $route.path == '/user' }"
      >
        个人中心
      </li>
      <li
        @click="$router.push('/order')"
        :class="{ current: $route.path == '/order' }"
      >
        我的订单
      </li>
      <li
        @click="$router.push('/free')"
        :class="{ current: $route.path == '/free' }"
      >
        专属福利
      </li>
    </ul>
    <!-- 右边搜索 -->
    <div class="search-box">
      <input
        type="text"
        placeholder="请输入内容"
        v-model="searchKeyword"
        @keyup.enter="searchFn"
      />
      <span @click="searchFn">
        <img src="../assets/img/search.png" alt="" />
      </span>
    </div>
  </div>
</template>

<script>
import { mapMutations } from "vuex";
export default {
  data() {
    return {
      searchKeyword: "",
    };
  },

  mounted() {},

  methods: {
    searchFn() {
      this.$router.push(this.$route.path + "?keyword=" + this.searchKeyword);
      this.searchKeyword = "";
    },
  },
};
</script>

<style lang="less" scoped>
.header-wrap {
  height: 118px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .nav-box {
    display: flex;
    justify-content: space-between;
    width: 500px;
    height: 16px;
    font-size: 16px;
    font-family: SourceHanSansSC;
    font-weight: 500;
    color: #242b39;
    line-height: 23px;
    li {
      cursor: pointer;
      &.current {
        color: #0a328e;
        font-weight: 700;
      }
    }
  }
  .search-box {
    display: flex;
    align-items: center;
    input {
      width: 214px;
      height: 40px;
      border: 1px solid #dedede;
      border-radius: 20px 0px 0px 20px;
      text-indent: 1em;
      outline: none;
      box-sizing: border-box;
    }
    span {
      img {
        width: 15px;
        height: 15px;
      }
      width: 50px;
      height: 40px;
      line-height: 40px;
      text-align: center;
      background: #0a328e;
      border-radius: 0px 20px 20px 0px;
    }
  }
}
</style>